package com.shouer.doc.dialog;

import android.content.Context;

import com.shouer.doc.R;

/**
 * Created by yangyayun on 2016/12/22.
 */

public class ShouerLoadingDialogUtil implements DialogDismissListener{

    private static ShouerLoadingDialogUtil instance;

    private ShouerLoadingDialog mDialog;

    public static ShouerLoadingDialogUtil getInstance() {
        if (instance == null) {
            synchronized (ShouerLoadingDialogUtil.class) {
                if (instance == null) {
                    instance = new ShouerLoadingDialogUtil();
                }
            }
        }
        return instance;
    }


    public void show(Context context)
    {
        if (mDialog==null||!mDialog.isShowing())
        {
            mDialog=new ShouerLoadingDialog(context, R.style.dialog_tran);
        }

        mDialog.withDialogDismissListener(ShouerLoadingDialogUtil.this).show();
    }

    public void dismiss()
    {
        if (null!=mDialog&&mDialog.isShowing())
        {
            mDialog.dismiss();
        }
    }

    @Override
    public void onDialogDismiss() {
        mDialog=null;
    }
}
